<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>{$Think.config.site.title} - 设备详情</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">
    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.css" rel="stylesheet"> 
    <link type="text/css" rel="stylesheet" href="{$Think.config.site.resource_url}css/bootstrap-progressbar-3.1.1.min.css">
   	<link href="{$Think.config.site.resource_url}css/plugins/sweetalert/sweetalert.css" rel="stylesheet">    
    <link href="{$Think.config.site.resource_url}css/style.css?v=4.1.0" rel="stylesheet">

    <link rel="stylesheet" href="{$Think.config.site.resource_url}css/cdb.css" rel="stylesheet">
    <style type="text/css">
    	.progress.vertical .progress-bar {writing-mode: tb-rl;}

   </style>
</head>
<body>
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
		<h3></h3>
			<div class="col-sm-12">
				<div class="row">
					<div class="cdb-box" style="margin-top: 10px;">
						<div class="row">
							<div class="col-sm-12 dianliang">
								<div class="dl_main">

									<ul class="dl_list" id="listcdb">
									<?php if(isset($data['stockDetail']['info'])){?>
									<?php $arr = $data['stockDetail']['info']; ?>
									
										<?php for($i = 1;$i <= 10;$i++){?>
										<?php if(isset($arr[$i]['batteryid'])){ ?>
										<?php $power = $arr[$i]['power'];?>

										<li class="list_{$i}">
											<a href="javascript:void(0)" title="{:lang('点击弹出充电宝')}" data-id="<?php echo $arr[$i]['batteryid']; ?>" data-key="{$i}" data-power="{$power}" class="btncdb" data-fid="{$cabinet_id}">
												<div class="progress progress-striped active vertical wide bottom">
                                                    <div role="progressbar"  class="progress-bar progress-bar-success {if condition="$power eq 0"} dl01 {elseif condition="$power eq 1"/} dl02 {elseif condition="$power eq 2"/} dl03 {elseif condition="$power eq 3" /} dl04 {elseif condition="$power eq 4" /} dl05 {/if}" style="{if condition="$power eq 0"} height: 20% {elseif condition="$power eq 1"/} height: 40% {elseif condition="$power eq 2"/} height: 60% {elseif condition="$power eq 3" /} height:80% {elseif condition="$power eq 4" /} height: 100% {/if};" aria-valuenow="{if condition="$power eq 0"} ) 0~19 {elseif condition="$power eq 1"/} 20~39 {elseif condition="$power eq 2"/} 40~59 {elseif condition="$power eq 3" /} 60~79 {elseif condition="$power eq 4" /} 80~100 {/if}">{if condition="$power eq 0"} ) {:lang('电 量')} 0%~20% {elseif condition="$power eq 1"/} {:lang('电 量')} 20%~40% {elseif condition="$power eq 2"/} {:lang('电 量')} 40%~60% {elseif condition="$power eq 3" /} {:lang('电 量')} 60%~80% {elseif condition="$power eq 4" /} {:lang('电 量')} 80%~100% {/if}</div>
                                                </div>
											</a>
										</li>
										<?php }else {?>
											<li class="list_{$i}">
											<a href="javascript:void(0)">
												<img src="{$Think.config.site.resource_url}images/null.png" alt="">
											</a>
										</li>
										<?php } ?>
										<?php } ?>
										<?php }else{?>
											<?php for($i = 1;$i <= 10;$i++){?>
											<li class="list_{$i}">
												<a href="javascript:void(0)">
													<img src="{$Think.config.site.resource_url}images/null.png" alt="">
												</a>
											</li>
											<?php } ?>
										<?php } ?>
										
									</ul>
									<div class="clearfix"></div>
									
								</div>
								
								
							</div>
							<div style="clear: both;"></div>
							<div class="row" style="margin-top: 100px;">
								<div class="col-sm-12">
									<p>　　{:lang('温馨提示：在重启、更新、弹出充电宝等设备之前，请先把机柜模式修改为调试模式即可。')}</p>
									<!--<button type="button" class="btn btn-w-m btn-primary" id="configure" data-id="{$cabinet_id}">查看配置文件</button>-->
									<button type="button" class="btn btn-w-m btn-primary" id="version" data-id="{$cabinet_id}">{:lang('查看版本信息')}</button>
									<button type="button" class="btn btn-w-m btn-primary" id="restart" data-id="{$cabinet_id}">{:lang('重启设备')}</button>　　
									<button type="button" class="btn btn-w-m btn-primary" id="update" data-id="{$cabinet_id}">{:lang('更新配置')}</button>
									<button type="button" class="btn btn-w-m btn-primary" id="remoteupdate" data-id="{$cabinet_id}">{:lang('远程升级')}</button>
									<?php
									$module = \think\Request::instance()->module();
									if( $module == 'ausadmin' ){
									?>
										<button type="button" class="btn btn-w-m btn-primary" id="openalock" data-id="{$cabinet_id}">{:lang('打开指定电子锁')}</button>
										<button type="button" class="btn btn-w-m btn-primary" id="openalllock" data-id="{$cabinet_id}">{:lang('打开所有电子锁')}</button>
									<?php } ?>
								</div>
								
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap-progressbar.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
     <script src="{$Think.config.site.resource_url}js/plugins/sweetalert/sweetalert.min.js"></script>
	<script type="text/javascript">
		$(function(){
			//查看配置文件
			/*$('#configure').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('查看设备配置文件信息')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['40%', '30%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/configure?cabinet_id='+cabinet_id
                });
			});*/
			//查看版本信息
			$('#version').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('查看设备版本信息')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['30%', '35%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/version?cabinet_id='+cabinet_id
                });
			});
			//重启设备
			$('#restart').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('重启设备')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['30%', '35%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/restart?cabinet_id='+cabinet_id
                });
			});
			//更新文件配置
			$('#update').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('更新文件配置信息')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['35%', '55%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/updateconf?cabinet_id='+cabinet_id
                });
			});
			//远程升级
			$('#remoteupdate').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('远程升级OTA')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['40%', '50%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/updatestatus?cabinet_id='+cabinet_id
                });

			});
			//打开指定电子锁
			$('#openalock').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('打开指定电子锁')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['40%', '50%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/openalock?cabinet_id='+cabinet_id
                });

			});
			//打开所有电子锁
			$('#openalllock').click(function(){
				var cabinet_id = $(this).data("id");
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('打开所有电子锁')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['30%', '35%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/openalllock?cabinet_id='+cabinet_id
                });

			});
			//充电宝信息
			$('.btncdb').click(function(){
				var batteryid = $(this).data("id");
				var key = $(this).data("key");
				var power = $(this).data("power");
				var cabinet_id = $(this).data("fid")
				layer_font = layer.open({
                  type: 2,
                  title: "{:lang('充电宝信息')}",
                  shadeClose: true,
                  shade: 0.8,
                  area: ['35%', '55%'],
                  content: '<?php echo \think\Request::instance()->root(); ?>/<?php echo \think\Request::instance()->module(); ?>/Equipment/info?batteryid='+batteryid+'&key='+key+'&power='+power+'&cabinetid='+cabinet_id
                });
			});

			
			
		});
	</script>
</body>
</html>